<#assign pageName="加班审批管理">
<@override name="page-content">
<form class="layui-form form-horizontal" role="form" method="post">
    <div class="layui-form-search panel">
        <input type="text" hidden="hidden" name="_STATE"/>
        <@ctrl.SingleSelectQuery path="bsLeaveInfo.auditStatus" labelText="审批状态" 
            options=approveStatusMap![] text="1" value="0">
            <option value="">—全部—</option>
        </@ctrl.SingleSelectQuery>
        <div class="margin-5">
            <a href="javascript:" onclick="$('#pageNo').val(1);$('form:first').submit();" class="layui-btn layui-btn-sm">
                <i class="layui-icon layui-icon-search"></i>查询
            </a>
            <a href="javascript:" class="layui-btn layui-btn-warm layui-btn-sm js-reset">
                <i class="layui-icon layui-icon-refresh-1"></i>重置
            </a>
        </div>
    </div>
    <table class="layui-table">
        <thead>
            <tr>
                <th class="align-center" width="50px" nowrap="nowrap">序号</th>
                <th class="align-center">员工姓名</td>
                <th class="align-center">所在部门</td>
                <th class="align-center">开始时间</td>
                <th class="align-center">结束时间</td>
                <th class="align-center">申请时间</td>
                <th class="align-center">审批状态</td>
                <th class="align-center">当前环节</td>
<!--                 <th class="align-center">审批状态</td> -->
                <th class="align-center">当前处理人</td>
                <th class="align-center" width="100px">操作</th>
            </tr>
        </thead>
        <tbody>
        <#if (queryResult.rows)?has_content>
            <#list queryResult.rows as dataItem>
            <tr>
                <td class="align-center" width="50px" nowrap="nowrap">
                    ${(pageNo-1)*pageSize+dataItem_index+1}
                </td>
                <td class="align-center">
                    ${dataItem.emp_name}
                </td>
                <td class="align-center">
                    ${dataItem.dep_name}
                </td>
                <#if dataItem.leave_category == "1">
                	 <td class="align-center">
                    	${dataItem.start_date?string('yyyy-MM-dd HH:mm')}
	                </td>
	                <td class="align-center">
	                    ${dataItem.end_date?string('yyyy-MM-dd HH:mm')}
	                </td>
	            <#else>
	            	<td class="align-center">
                    	${dataItem.start_date?string('yyyy-MM-dd')}
	                </td>
	                <td class="align-center">
	                    ${dataItem.end_date?string('yyyy-MM-dd')}
	                </td>
                </#if>
                <td class="align-center">
	                    ${dataItem.create_time?string('yyyy-MM-dd HH:mm:ss')}
                </td>
                <td class="align-center">
                    ${getStatusName(applyStatusMap, dataItem.audit_status)}
                </td> 
                <td class="align-center">
                    ${dataItem.task_name}                  
                </td>
<!--                 <td class="align-center">
                    ${getStatusName(approveStatusMap, dataItem.proc_status)}
                </td> -->
                <td class="align-center">
                    <#if dataItem.proc_status == "00">
                        <#if chargeRecord?has_content>
	                        <#list users as userInfo>
	                        	<#if userInfo.userId == dataItem.candidate>
	                        		${userInfo.uname}
	                        	</#if>
	                        </#list>
                        </#if>
                    <#elseif dataItem.proc_status == "10">
                        <#list users as userInfo>
                        	<#if userInfo.userId == dataItem.assignee>
                        		${userInfo.uname}
                        	</#if>
                        </#list>
                    <#else>
                        ——
                    </#if>
                </td>
                <td class="align-center">
                    <div class="layui-table-cell">
                        <#if dataItem.proc_status == "00" && dataItem.candidate == userId>
                            <a href="claim/${dataItem.process_id}/${dataItem.task_id}" class="layui-btn layui-btn-warm layui-btn-xs" >
                                <i class="layui-icon layui-icon-flag"></i>签收
                            </a>
                        <#elseif dataItem.proc_status == "10" && dataItem.assignee == userId>
                            <a href="approve/${dataItem.process_id}/${dataItem.task_id}" class="layui-btn layui-btn-danger layui-btn-xs" >
                                <i class="layui-icon layui-icon-survey"></i>审批
                            </a>
                        </#if>                        
                        <a href="detail/${dataItem.process_id}" class="layui-btn layui-btn-normal layui-btn-xs" >
                            <i class="layui-icon layui-icon-about"></i>详情
                        </a>
                    </div>
                </td>
            </tr>
            </#list>
        <#else>
            <tr class="align-center">
                <td style="color:red;font-weight:bold;" colspan="11">暂无符合条件的请假申请信息！</td>
            </tr>
        </#if>
        </tbody>        
    </table>
    <@ctrl.pageShow (queryResult.total)!0, (queryResult.pageIndex)!0 />
</form>
</@override>
<@override name="page-scripts">
    <script>
        $(function(){
            layui.use(['form','layer','element', 'jquery'], function(){
                var form=layui.form;
                var layer=layui.layer;
                var element = layui.element;
                var $ = layui.jquery;
                $('.js-reset').on('click', function(){
                    $('#pageNo').val(1);
                    $('#auditStatus').val("");
                    $('form:first').submit();
                });
            })
        })
    </script>
</@override>
<@extends name="/layout/basepage.html"/> 
